﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QS.Logic.Objects;
using Microsoft.Xna.Framework;

namespace QS.Game.Logic.Physics
{
    class QFrictionForce : QAbstractForce
    {
        public QFrictionForce(QPhysicsObject physicsObject)
            : base(physicsObject)
        {
        }

        protected override void updateForce()
        {
            if (this.PhysicsObject.Speed.Length() > 0.0005f)
            {
                Vector3 normalSpeed = new Vector3(this.PhysicsObject.Speed.X, this.PhysicsObject.Speed.Y, this.PhysicsObject.Speed.Z);
                normalSpeed.Normalize();
                this.PhysicsObject.Speed -= normalSpeed * 0.0005f;
            }
            else
                this.PhysicsObject.Speed = Vector3.Zero;
        }
    }
}
